/**
 * createTime: 2018/3/19 14:14
 * author: zhibin.zhao
 * description:
 */
'use strict';
const express = require('express');
const app = express();
function mw1(req, res, next) {
    console.log("我是MW1");
    next();
}
function mw2(req, res, next) {
    console.log("我是MW2");
    next();
}

var r1 = express.Router();
r1.get('/', function (req, res, next) {
    console.log("我是r1");
    next();
});

var r2 = express.Router();
r2.get('/', function (req, res, next) {
    console.log("我是r2");
    next();
});

var subApp = express();
subApp.get('/', function (req, res, next) {
    console.log("我是subApp");
    next();
});

app.use(mw1, [mw2, r1, r2], subApp);

app.listen(3000);